package com.cleaningcloud.cld.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.cleaningcloud.cld.domain.dto.CldRegularPlanDto;
import com.cleaningcloud.cld.domain.vo.CldRegularPlanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cleaningcloud.common.log.annotation.Log;
import com.cleaningcloud.common.log.enums.BusinessType;
import com.cleaningcloud.common.security.annotation.RequiresPermissions;
import com.cleaningcloud.cld.domain.CldRegularPlan;
import com.cleaningcloud.cld.service.ICldRegularPlanService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.utils.poi.ExcelUtil;
import com.cleaningcloud.common.core.web.page.TableDataInfo;

/**
 * 例会计划Controller
 * 
 * @author cleaningcloud
 * @date 2025-01-13
 */
@RestController
@RequestMapping("/regularPlan")
public class CldRegularPlanController extends BaseController
{
    @Autowired
    private ICldRegularPlanService cldRegularPlanService;

    /**
     * 查询例会计划列表
     */
    @RequiresPermissions("cld:regularPlan:list")
    @GetMapping("/list")
    public TableDataInfo list(CldRegularPlan cldRegularPlan)
    {
        startPage();
        List<CldRegularPlanVo> list = cldRegularPlanService.selectCldRegularPlanList(cldRegularPlan);
        return getDataTable(list);
    }

    /**
     * 获取例会计划详细信息
     */
    @RequiresPermissions("cld:regularPlan:query")
    @GetMapping(value = "/{regularPlanId}")
    public AjaxResult getInfo(@PathVariable("regularPlanId") Long regularPlanId)
    {
        return success(cldRegularPlanService.selectCldRegularPlanByRegularPlanId(regularPlanId));
    }

    /**
     * 新增例会计划
     */
    @RequiresPermissions("cld:regularPlan:add")
    @Log(title = "例会计划", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CldRegularPlanDto cldRegularPlanDto)
    {
        return toAjax(cldRegularPlanService.insertCldRegularPlan(cldRegularPlanDto));
    }

    /**
     * 修改例会计划
     */
    @RequiresPermissions("cld:regularPlan:edit")
    @Log(title = "例会计划", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CldRegularPlanDto cldRegularPlanDto)
    {
        return toAjax(cldRegularPlanService.updateCldRegularPlan(cldRegularPlanDto));
    }

    /**
     * 删除例会计划
     */
    @RequiresPermissions("cld:regularPlan:remove")
    @Log(title = "例会计划", businessType = BusinessType.DELETE)
	@DeleteMapping("/{regularPlanIds}")
    public AjaxResult remove(@PathVariable Long[] regularPlanIds)
    {
        return toAjax(cldRegularPlanService.deleteCldRegularPlanByRegularPlanIds(regularPlanIds));
    }
}
